<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix= "fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<c:import url="/view/admin/include/header/adminHeader.jsp"></c:import>
    <!-- 컨텐츠 부분 -->
	<div id="container">
    	<!-- 왼쪽 메뉴 부분 -->
    	<c:import url="/view/admin/include/left/adminLeft.jsp"></c:import>
        <!-- 왼쪽 메뉴 부분 -->
        <!-- 오른쪽 내용 부분 -->
        <dl>
        	<dd class="path">
        	홈 > 게시판 관리 > 
        		<span class="path_b">
        			소송진행 현황
        		</span>
        	</dd>
        </dl>
        <dl class="content">
            <dd class="summary">
      
   		<ul class="tab qna_box">
           <a href="/admin/caseDetail.hcom?case_seq=${case_seq}&mem_dept=${mem_dept}"><li class="off">기본정보</li></a>
	       <a href="/admin/caseDetail1.hcom?case_seq=${case_seq}&court_step=1&mem_dept=${mem_dept}"><li class="off">제1심</li></a>
	       <a href="/admin/caseDetail2.hcom?case_seq=${case_seq}&court_step=2&mem_dept=${mem_dept}"><li class="on">제2심</li></a>
	       <a href="/admin/caseDetail3.hcom?case_seq=${case_seq}&court_step=3&mem_dept=${mem_dept}"><li class="off">대법원</li></a>
        </ul>
            	<form id="boardFrm" name="boardFrm"  method="post" enctype="multipart/form-data">
            	<input type="hidden" name="mem_no"	value="<s:property value="#session.id" />"> 
            	<input type="hidden" name="writer" value="<s:property value="#session.name" />">
            	<input type="hidden" id="save_type" name="save_type" value="case" />
            	<input type="hidden" id="mem_dept" name="mem_dept" value="${mem_dept}" />
            	<input type="hidden" id="case_seq" name="case_seq" value="${case_seq}" />
            	<input type="hidden" id="list" name="list" value="${list}" />
            	<input type="hidden" id="safe" name="safe" value="${printView3.case_no}"/>
            <s:if test="%{boardView.case_no != NULL}">
            <span class="left f_orange">※ 진행 중이거나 완료된 소송기록을 확인하실 수 있습니다.</span>
            	<p class="align_r"><a id="/admin/Printecase2.hcom?case_seq=${case_seq}&mem_dept=${mem_dept}&court_step=2" onClick="Pop_info6(this.id);" style="cursor: pointer"><img src="/images/common/btn_print.gif" width="50" height="19" alt="인쇄" /></a></p>
            	<table cellspacing="0" cellpadding="0" summary="" >
                	<caption></caption>
                    	 <colgroup>
                          <col width="15%;"/>
                          <col width="45%;"/>
                          <col width="10%;"/>
                          <col width="30%"/>
                         </colgroup>
                    <tbody>
                    	<tr>
                        	<th scope="row" class="table_txt_left">사건번호</th>
                            <td class="table_txt_left">${boardView.case_no}
                            </td>
                            <th scope="row" class="table_txt_left">제(피)소일</th>
                            <td colspan="3" class="table_txt_left f_blue">${fn:substring(boardView.case_date,0,4)}-${fn:substring(boardView.case_date,4,6)}-${fn:substring(boardView.case_date,6,8)}</td>
                        </tr>
                    	<tr>
                        	<th scope="row" class="table_txt_left">관할법원</th>
                            <td class="table_txt_left">${boardView.court_name}</td>
	                        <th scope="row" class="table_txt_left">재판부</th>
                      		<td class="table_txt_left" >${boardView.court_dept}</td> 
                         </tr>  
                         <tr>
                         	<th scope="row" class="table_txt_left">주심</th>
                            <td class="table_txt_left">${boardView.head_referee}</td> 
                         	<th scope="row" class="table_txt_left">종국결과</th>
                            <td class="table_txt_left">${boardView.final_status}</td> 
                         </tr> 
                         <tr>
    	                    <th scope="row" class="table_txt_left">원고대리인</th>
                            <td class="table_txt_left">${boardView.plaintiff_agent}</td> 
	                        <th scope="row" class="table_txt_left">피고대리인</th>
                           <td class="table_txt_left">${boardView.defendant_agent}
                         </tr>   
					</tbody>
                 </table>
                 </div>
                 </form>
            </dd>
        </dl>
        <dl>  	
            <dd class="btn_right">
             <%-- <s:if test="%{boardView.writer.equals(#session.name)}"> --%>
            	<input type="button" id="btnWrite" value="수정" class="input_btn_s b" />
            	<input type="button" id="btndelete" value="삭제" class="input_btn_s b" />
            	<!-- <input type="button" id="btndel" value="삭제" class="input_btn_s b" /> -->
             <%-- </s:if> --%>
            	<input type="button" id="btnList" value="목록" class="input_btn_s b" />
            </dd>
        </dl>
           <p class="h_30"></p>
        </s:if>
        <!-- 추가부분 -->
        <s:else>
      <span class="left f_orange">※ 진행 중이거나 완료된 소송기록을 확인하실 수 있습니다.</span>
        <table cellspacing="0" cellpadding="0" summary="" >
                	<caption></caption>
                    	 <colgroup>
                          <col width="15%;"/>
                          <col width="45%;"/>
                          <col width="10%;"/>
                          <col width="30%"/>
                         </colgroup>
                    <tbody>
                   		<tr>
                    		<td colspan="4">게시물이 없습니다.</td>
                    	<tr>
                    </tbody>
                 </table>
                 </dd>
        </dl>
         <dl>  	
            <dd class="btn_right">
            <s:if test="%{boardView.writer.equals(#session.name)}">
            <input class="input_btn_s b" type="button" id="btnAdd" value="추가"/>
            </s:if>
            <input type="button" id="btnList" value="목록" class="input_btn_s b" />
            </dd>
        </dl>
         <p class="h_30"></p>
        </s:else>
          <dl class="content">          
            <dd class="">
            	<table cellspacing="0" cellpadding="0" summary="" >
                	<caption></caption>
                    	 <colgroup>
							<col width="20%;"/>
							<col width="50%;"/>
							<col width="30%;"/>
							<%-- <col width="10%;"/> --%>
                         </colgroup>
                    <thead>
                    	<tr>
	                       	<th scope="col" class="table_th_bottom">년 월 일</th>
	                        <th scope="col" class="table_th_bottom">주요내용</th>
	                        <th scope="col" class="table_th_bottom">비고</th>
	                        <!-- <th scope="col" class="table_th_bottom">기능</th> -->
                        </tr>
                    </thead>
                    <tbody>
                    	<s:if test="%{1 > list.size()}">
                    	<tr>
                    		<td colspan="3">게시물이 없습니다.</td>
                    	<tr>
                    	</s:if>
                    	<s:iterator value="list" status="i">
						<tr>
							<td style="text-align:left;">${fn:substring(log_date,0,4)}-${fn:substring(log_date,4,6)}-${fn:substring(log_date,6,8)}</td>
							<td style="text-align:left;">${log_content }
											<c:if test="${flag == 'Y'}">
		                           			<img src="/images/admin/icon_new.gif" width="25" height="12" alt="new_icon" />
		                           			</c:if>
								<c:if test="${!empty file1_name}">
								<a id="${case_seq}|${court_step}|${log_seq}|${attach1_seq}" class="fileDown" style="cursor:pointer"><img src="../../../images/common/icon_disk.png" width="13" height="13" title="${file1_name}" /></a>
								</c:if>
								<c:if test="${!empty file2_name}">
								<a id="${case_seq}|${court_step}|${log_seq}|${attach2_seq}" class="fileDown" style="cursor:pointer"><img src="../../../images/common/icon_disk.png" width="13" height="13" title="${file2_name}" /></a>
								</c:if>
								<c:if test="${!empty file3_name}">
								<a id="${case_seq}|${court_step}|${log_seq}|${attach3_seq}" class="fileDown" style="cursor:pointer"><img src="../../../images/common/icon_disk.png" width="13" height="13" title="${file3_name}" /></a>
								</c:if>
							</td>
		           			<td style="text-align:left;">${log_note }</td>	
							<!-- <td>
							수정|삭제
							</td> -->
						</tr>
						</s:iterator>
                    </tbody>
                 </table>
            </dd>
        </dl>
        <!-- 오른쪽 내용 부분 -->
    <!-- 컨텐츠 부분 -->
<c:import url="/view/admin/include/footer/adminFooter.jsp"></c:import>
<script type="text/javascript" src="/jquery/datepicker.js"></script>
<script type="text/javascript" src="/jquery/jquery.watermarkinput.js" ></script>
<script type="text/javascript">
$().ready(function(){		
	
	$("#btnList").click(function(){
		location.href="/admin/caseList.hcom?";
	});
	
	$("#btnNext").click(function(){
		if(confirm("등록하시겠습니까?")){
		$("#boardFrm").attr('action','/admin/caseReg2.hcom?').submit();
			}
	});

	$("#btnWrite").click(function(){
		location.href="/admin/caseupdatego2.hcom?case_seq=${case_seq}&court_step=2";
	});
	
	$("#btndel").click(function(){
		location.href="/admin/caseDelete2.hcom?case_seq=${case_seq}&court_step=2";
	});
	
	
	$("#btndelete").click(function(){
	var list = $("#list").val();
	var safe = $("#safe").val();
	if(list != ''){
		if(list == '[]' && safe == ''){
			confirm('삭제하시겠습니까?');
			location.href="/admin/casecourtDelete.hcom?case_seq=${case_seq }&court_step=2"; 
		}else{
			confirm('하단주요내용 과 대법원내용을 확인하여 삭제하십시요.');
		}
	}
	});
			
	/*$("#btndelete").click(function(){
		alert($("#list").val());
	}); */
	
	
	$("#btnAdd").click(function(){
		location.href="/admin/caseAddReg2.hcom?case_seq=${case_seq }&court_step=2";
	});
	
	
	$("#btnSave").click(function(){
		if(validateCheck()){
			if(confirm("등록하시겠습니까?")){
		$("#boardFrm").attr('action','/admin/caseReg2s.hcom?').submit();
			}
		}
	});
	
});

$(".fileDown").click(function(){
	var str = $(this).attr('id');
	var array = str.split('|');
	var case_seq = $.trim(array[0]);
	var court_step = $.trim(array[1]);
	var log_seq = $.trim(array[2]);
	var attach_seq = $.trim(array[3]);
	
	location.href='/admin/fileDownloadTh.hcom?case_seq='+case_seq+'&court_step='+court_step+'&log_seq='+log_seq+'&attach_seq='+attach_seq;
	
	
});
</script>
